<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title></title>
    <script>
    //早期对象
    /*function User(name, pass){
      this.name=name;
      this.pass=pass;
    }

    User.prototype.showName=function (){
      alert(this.name);
    };
    User.prototype.showPass=function (){
      alert(this.pass);
    };*/

    class User{
	  //构造函数
      constructor(name, pass){
        this.name=name;
        this.pass=pass;
      }
      //原型上方法
      showName(){
        alert(this.name);
      }
      showPass(){
        alert(this.pass);
      }
    }

    var u1=new User('blue', '123456');

    u1.showName();
    u1.showPass(); 
    </script>
  </head>
  <body>

  </body>
</html>
